<template>
  <div class="content-wrapper">
    <div class="content-header">新建</div>
    <div class="content-container">
      <el-row>
        <el-col :span="4">
          <div class="bucket-menu-title">
            <span>文档</span>
          </div>
          <el-menu class="bucket-menu" :router="true">
            <el-menu-item @click.native="createDocument(1)">
              <svg class="icon iconcalss" aria-hidden="true">
                <use xlink:href="#el-icon-alldocx"></use>
              </svg>
              <span slot="title">新建文档</span>
            </el-menu-item>
            <el-menu-item @click.native="createDocument(2)">
              <svg class="icon iconcalss" aria-hidden="true">
                <use xlink:href="#el-icon-allxlsx"></use>
              </svg>
              <span slot="title">新建表格</span>
            </el-menu-item>
            <el-menu-item @click.native="createDocument(3)">
              <svg class="icon iconcalss" aria-hidden="true">
                <use xlink:href="#el-icon-allpptx"></use>
              </svg>
              <span slot="title">新建演示稿</span>
            </el-menu-item>
            <el-menu-item @click.native="createFolder" divided>
              <svg class="icon iconcalss" aria-hidden="true">
                <use xlink:href="#el-icon-allweibiaoti-_huabanfuben"></use>
              </svg>
              <span slot="title">新建文件夹</span>
            </el-menu-item>
          </el-menu>
          <div class="bucket-menu-title">
            <span>上传文档</span>
          </div>
          <el-menu class="bucket-menu" :router="true">
            <el-menu-item>
              <i class="el-icon-document document-icon"></i>
              <span slot="title">上传文件</span>
            </el-menu-item>
            <el-menu-item>
              <i class="el-icon-folder folder-icon"></i>
              <span slot="title">上传文件夹</span>
            </el-menu-item>
          </el-menu>
        </el-col>
        <el-col :span="4">
          <div class="bucket-menu-title">
            <span>流程</span>
          </div>
          <el-menu class="bucket-menu" :router="true">
            <el-menu-item index="/flow/flow_new">
              <i class="el-icon-circle-plus-outline"></i>
              <span slot="title">新增流程</span>
            </el-menu-item>
            <el-menu-item index="/flow/flow_modify">
              <i class="el-icon-circle-check"></i>
              <span slot="title">修订流程</span>
            </el-menu-item>
            <el-menu-item index="/flow/flow_delete/0">
              <i class="el-icon-remove-outline"></i>
              <span slot="title">作废流程</span>
            </el-menu-item>
            <el-menu-item index="/">
              <i class="el-icon-download"></i>
              <span slot="title">下载审批流程</span>
            </el-menu-item>
            <el-menu-item index="/">
              <i class="el-icon-reading"></i>
              <span slot="title">借阅流程</span>
            </el-menu-item>
          </el-menu>
        </el-col>
        <el-col :span="4">
          <div class="bucket-menu-title">
            <span>培训</span>
          </div>
          <el-menu class="bucket-menu" :router="true">
            <el-menu-item index="/train/train_new">
              <i class="el-icon-circle-plus-outline"></i>
              <span slot="title">培训计划</span>
            </el-menu-item>
          </el-menu>
        </el-col>
        <el-col :span="4">
          <div class="bucket-menu-title">
            <span>记录</span>
          </div>
          <el-menu class="bucket-menu" :router="true">
            <el-menu-item index="/manufacture/manufacture_new_apply">
              <i class="el-icon-circle-plus-outline"></i>
              <span slot="title">生产指令</span>
            </el-menu-item>
          </el-menu>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {}
  },
  methods: {
    createDocument(val) {
      var data = {
        repositoryId: 0,
        documentType: val,
        folderId: 0,
        token: this.$store.getters.token
      }
      window.open(
        'onlyoffice/createDocument.html?repositoryId=' +
          data.repositoryId +
          '&documentType=' +
          data.documentType +
          '&folderId=' +
          data.folderId +
          '&token=' +
          data.token +
          '&urldata=' +
          process.env.VUE_APP_BASE_API
      )
    },
    createFolder() {
      this.$prompt('新建文件夹名称', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      })
        .then(({ value }) => {
          var data = {
            repositoryId: this.temp.repositoryId,
            parentFolderId:
              this.multipleSelection.length > 0
                ? this.multipleSelection[0].folderId
                : this.temp.parentFolderId
                ? this.temp.parentFolderId
                : 0,
            folderName: value
          }
          saveFolder(data).then((res) => {

              this.$message.success('创建成功')
            
          })
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '取消创建'
          })
        })
    }
  }
}
</script>
